package com.graduation.mybatis.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * @TableName food
 */
@TableName(value ="food")
@Data
public class Food implements Serializable {
    @TableId
    private Integer id;

    private String name;

    private String category;

    private Double calories;

    private Double protein;

    private Double fat;

    private Double carbohydrate;

    private Double vitamin;

    private Double mineral;

    private String image;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Food other = (Food) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCategory() == null ? other.getCategory() == null : this.getCategory().equals(other.getCategory()))
            && (this.getCalories() == null ? other.getCalories() == null : this.getCalories().equals(other.getCalories()))
            && (this.getProtein() == null ? other.getProtein() == null : this.getProtein().equals(other.getProtein()))
            && (this.getFat() == null ? other.getFat() == null : this.getFat().equals(other.getFat()))
            && (this.getCarbohydrate() == null ? other.getCarbohydrate() == null : this.getCarbohydrate().equals(other.getCarbohydrate()))
            && (this.getVitamin() == null ? other.getVitamin() == null : this.getVitamin().equals(other.getVitamin()))
            && (this.getMineral() == null ? other.getMineral() == null : this.getMineral().equals(other.getMineral()))
            && (this.getImage() == null ? other.getImage() == null : this.getImage().equals(other.getImage()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCategory() == null) ? 0 : getCategory().hashCode());
        result = prime * result + ((getCalories() == null) ? 0 : getCalories().hashCode());
        result = prime * result + ((getProtein() == null) ? 0 : getProtein().hashCode());
        result = prime * result + ((getFat() == null) ? 0 : getFat().hashCode());
        result = prime * result + ((getCarbohydrate() == null) ? 0 : getCarbohydrate().hashCode());
        result = prime * result + ((getVitamin() == null) ? 0 : getVitamin().hashCode());
        result = prime * result + ((getMineral() == null) ? 0 : getMineral().hashCode());
        result = prime * result + ((getImage() == null) ? 0 : getImage().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", foodId=").append(id);
        sb.append(", foodName=").append(name);
        sb.append(", category=").append(category);
        sb.append(", calories=").append(calories);
        sb.append(", protein=").append(protein);
        sb.append(", fat=").append(fat);
        sb.append(", carbohydrate=").append(carbohydrate);
        sb.append(", vitamin=").append(vitamin);
        sb.append(", mineral=").append(mineral);
        sb.append(", image=").append(image);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}